<template>
  <CRUTemplate mode="add" :userIsYq="userIsYq" :hospitalInfo="hospitalInfo" />
</template>

<script>
import api from "@/api/commonApi";
import cookie from "@/utils/cookie.js";
import CRUTemplate from "./components/CRUTemplate";
export default {
  components: {
    CRUTemplate
  },
  data() {
    return {
      idttC: null,
      userIsYq: null,
      hospitalInfo: {
      }
    }
  },
  mounted() {
    this.userIsYq = cookie.getCookie("userIsYq");
    if (this.userIsYq === 'true') {
      this.idttC = cookie.getCookie("idttC");
      this.drugCompaniseDetail();
    }
  },
  methods: {
    drugCompaniseDetail() {
       this.$axios
        .post(api.mechanismregSearch, {
          id: this.idttC
        })
        .then(res => {
          if (res.data.code === 1) {
            const { id, orgName, linkmanTelephone, hosAddr} = res.data.object;
            this.hospitalInfo = {
              id: id,
              hospitalName: orgName,
              linkmanTelephone,
              hosAddr
            }
          } else {
            this.$Message.error(res.data.message);
          }
        });
    }
  }
}
</script>

<style scoped>
</style>